package replica;

import org.omg.CORBA.BooleanHolder;
import org.omg.CORBA.StringHolder;

import administrator.administratorService;
import common.CommonTools;

public class AdminClient {

	private administratorService administratorService;

	public AdminClient(administratorService administratorService) {
		this.administratorService = administratorService;
	}

	public String getPlayerStatus(String adminName, String adminPassword,
			String adminIPAddress) {

		CommonTools.writeLog("replica", "replica", "get player status started:"
				+ "adminName:" + adminName + "; adminIPAddress:"
				+ adminIPAddress, "replica");
		StringHolder status = new StringHolder();
		BooleanHolder result = new BooleanHolder();
		administratorService.getPlayerStatus(adminName, adminPassword,
				adminIPAddress, result, status);

		CommonTools.writeLog("replica", "replica", "get player status succeeded:"
				+ status.value, "replica");
		return status.value;
	}

	public String suspendAccount(String adminName, String adminPassword,
			String adminIPAddress, String userNameToSuspend) {

		CommonTools.writeLog("replica", "replica", "suspend Account started:"
				+ "adminName:" + adminName + "; adminIPAddress:"
				+ adminIPAddress + " userNameToSuspend: " + userNameToSuspend,
				"replica");

		StringHolder status = new StringHolder();
		BooleanHolder result = new BooleanHolder();
		administratorService.suspendAccount(adminName, adminPassword,
				adminIPAddress, userNameToSuspend, result, status);

		CommonTools.writeLog("replica", "replica", "suspend Account succeeded:"
				+ status.value, "replica");
		return status.value;

	}

}
